|
1
|
|
|
$.fn.check_all = function(target) |
|
2
|
|
|
{ |
|
3
|
|
|
var checked = $(this).is(':checked'); |
|
4
|
|
|
|
|
5
|
|
|
$(target).find("input[type='checkbox']").each(function() |
|
6
|
|
|
{ |
|
7
|
|
|
// Skip the write protected |
|
8
|
|
|
if ($(this).is(':disabled')) |
|
9
|
|
|
{ |
|
10
|
|
|
return; |
|
11
|
|
|
} |
|
12
|
|
|
|
|
13
|
|
|
if (checked) |
|
14
|
|
|
{ |
|
15
|
|
|
$(this).prop('checked', true); |
|
16
|
|
|
} |
|
17
|
|
|
else |
|
18
|
|
|
{ |
|
19
|
|
|
$(this).prop('checked', false); |
|
20
|
|
|
} |
|
21
|
|
|
|
|
22
|
|
|
// Trigger the onChange event of the input |
|
23
|
|
|
$(this).change(); |
|
24
|
|
|
}); |
|
25
|
|
|
}; |
|
26
|
|
|
|
|
27
|
|
|
$.fn.invert_selection = function(target) |
|
28
|
|
|
{ |
|
29
|
|
|
$(target).find("input[type='checkbox']").each(function() |
|
30
|
|
|
{ |
|
31
|
|
|
// Skip the write protected |
|
32
|
|
|
if ($(this).is(':disabled')) |
|
33
|
|
|
{ |
|
34
|
|
|
return; |
|
35
|
|
|
} |
|
36
|
|
|
|
|
37
|
|
|
$(this).prop('checked', !$(this).is(':checked')); |
|
38
|
|
|
|
|
39
|
|
|
// Trigger the onChange event of the input |
|
40
|
|
|
$(this).change(); |
|
41
|
|
|
}); |
|
42
|
|
|
|
|
43
|
|
|
$(this).prop('checked', false); |
|
44
|
|
|
}; |
|
45
|
|
|
|
|
46
|
|
|
$(document).ready(function() |
|
47
|
|
|
{ |
|
48
|
|
|
$('#batch_process tbody tr').find('td:first').addClass('first'); |
|
49
|
|
|
$('#batch_process tbody tr').find('td:last').addClass('last'); |
|
50
|
|
|
|
|
51
|
|
|
$("#batch_process tbody input[type='checkbox']").each(function() |
|
52
|
|
|
{ |
|
53
|
|
|
$(this).change(function() |
|
54
|
|
|
{ |
|
55
|
|
|
var object = this.parentNode, |
|
56
|
|
|
n = 0; |
|
57
|
|
|
|
|
58
|
|
|
while (!object.tagName.match(/tr/i)) |
|
59
|
|
|
{ |
|
60
|
|
|
object = object.parentNode; |
|
61
|
|
|
|
|
62
|
|
|
// Protect against infinite loops |
|
63
|
|
|
if (n > 20) |
|
64
|
|
|
{ |
|
65
|
|
|
return; |
|
66
|
|
|
} |
|
67
|
|
|
} |
|
68
|
|
|
|
|
69
|
|
|
if ($(this).is(':checked')) |
|
70
|
|
|
{ |
|
71
|
|
|
$(object).addClass('row_selected'); |
|
72
|
|
|
} |
|
73
|
|
|
else |
|
74
|
|
|
{ |
|
75
|
|
|
$(object).removeClass('row_selected'); |
|
76
|
|
|
} |
|
77
|
|
|
}); |
|
78
|
|
|
}); |
|
79
|
|
|
}); |
|
80
|
|
|
|